package com.hiwan.system.dao.auth;

import java.util.List;

import org.framework.dao.ServiceUtilDao;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.hiwan.system.pojo.AuthInfo;

/**
 * 
 * Datetime   ： 2013-12-30 上午9:35:15<br>
 * Title      :  AuthInfoDao.java<br>
 * Copyright  :  Copyright (c) 2013<br>
 * Company    :  HIWAN<br>
 * @author llg
 *
 */
@Component
@Service
@Repository
public class AuthInfoDao extends ServiceUtilDao {

	/**
	 * 查询转授权信息列表(分页)
	 * 
	 * @param AuthInfo
	 * @return
	 */
	public List<AuthInfo> selectAuthInfoListPage(AuthInfo AuthInfo) {
		return this.selectListPage("selectAuthInfoList", AuthInfo,
				AuthInfo.class);
	}

	/**
	 * 查询转授权信息列表(不分页)
	 * 
	 * @param AuthInfo
	 * @return
	 */
	public List<AuthInfo> selectAuthInfoList(AuthInfo AuthInfo) {
		return this.selectList("selectAuthInfoList", AuthInfo,
				AuthInfo.class);
	}

	/**
	 * 通过主键查询转授权信息
	 * 
	 * @param AuthInfo
	 * @return
	 */
	public AuthInfo selectAuthInfoById(String authUser,int seqNo) {
		AuthInfo info = new AuthInfo();
		info.setAuthUser(authUser);
		info.setSeqNo(seqNo);
		return this.selectOne("selectAuthInfoById",info, AuthInfo.class);
	}
	
	/**
	 *判断授权信息是否存在
	 * 
	 * @param AuthInfo
	 * @return
	 */
	public int isExistAuthInfo(AuthInfo info) {
		return this.selectOne("isExistAuthInfo",info,Integer.class);
	}

	/**
	 * 插入转授权信息
	 * 
	 * @param AuthInfo
	 * @return
	 */
	public int insertAuthInfo(AuthInfo AuthInfo) {
		return this.insert("insertAuthInfo", AuthInfo);
	}

	/**
	 * 更新转授权信息
	 * 
	 * @param AuthInfo
	 * @return
	 */
	public int updateAuthInfo(AuthInfo AuthInfo) {
		return this.update("updateAuthInfo", AuthInfo);
	}

	/**
	 * 删除转授权信息
	 * @param authUser
	 * @param seqNo
	 * @return
	 */
	public int deleteAuthInfoById(String authUser,int seqNo) {
		AuthInfo info = new AuthInfo();
		info.setAuthUser(authUser);
		info.setSeqNo(seqNo);
		return this.delete("deleteAuthInfo", info);
	}
	
	public Integer selectMaxSeqNoByUser(String authUser){
		Integer maxSeqNo = this.selectOne("selectMaxSeqNoByUser",authUser,Integer.class);
		return maxSeqNo;
	}
	
}
